<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Upload extends CI_Controller {

	

	public function index()
	{
//                FCPATH.'uploads/'
		$this->load->view('upload_view', array('error' => ''));
	}

	public function do_upload()
	{
		$config['upload_path'] = $this->config->item('upload_dir');
		$config['allowed_types'] = '*';
		$config['max_size'] = '300000';
                $config['name_encrypt'] = true;

		$this->load->library('upload', $config);

		if ( ! $this->upload->do_upload('Filedata'))
		{
			$error = array('error' => $this->upload->display_errors());

			$this->load->view('form', $error);
		}
		else
		{
			$data['upload_data'] = $this->upload->data();
			$this->load->view('success', $data);
		}
	}
}
?>